
const app =getApp()
Page({
  data: {
    pageNum:1,
    pageTotal:0,
    total:0,
    withdraw:0,
    gold: 0,
    wallet_list:[],
    walletView:false
  },
  onLoad: function (options) {
    this.getWalletList()
  },
  onReachBottom() {
    let _this = this;
    _this.setData({
      pageNum: _this.data.pageNum + 1
    })
    _this.getWalletList()
  },
  showWallet(){
    this.setData({
      walletView:!this.data.walletView
    })
  },
  getWalletList(){
    let _this = this
    app.util.request({
      url: 'api/record/findLimit',
      method: "post",
      data: {
        page:_this.data.pageNum,
        pageSize:10,
      },
      success(response) {
          if (response.data.code == 0) {
            _this.setData({
              pageTotal:response.data.data[0].record.pages,
              total:response.data.data[0].balance,
              withdraw:response.data.data[0].withdraw,
              gold: response.data.data[0].gold,
              wallet_list:[..._this.data.wallet_list,...response.data.data[0].record.list]
            })
          }
      }
    })
  },
  toWithDraw(){
    wx.navigateTo({
      url: '/pages/personal/wallet/withdraw-deposit/withdraw-deposit?value='+this.data.withdraw,
    })
  },
})
